<?php

namespace ApiBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;

class DefaultController extends Controller
{
    /**
     * API详细说明-
     * 会一直扫描到第一个注释
     *
     * @ApiDoc(
     *  resource=true,
     *  section=false,
     *  description="API简单说明",
     *  filters={
     *      {"name"="a-filter", "dataType"="integer"},
     *      {"name"="another-filter", "dataType"="string", "pattern"="(foo|bar) ASC|DESC"}
     *  },
     *  requirements={
     *      {
     *          "name"="limit",
     *          "dataType"="integer",
     *          "requirement"="要求",
     *          "description"=""
     *      }
     *  },
     *  tags={
     *     "这个是标签",
     *     "deprecated" = "#000"
     * },
     *  parameters={
     *      {"name"="参数1", "dataType"="integer", "required"=true, "format"="['格式']", "description"="描述"}
     *  }
     * )
     *
     */
    public function indexAction()
    {
        var_dump($this->get('request')->request->all());exit;
        return $this->render('ApiBundle:Default:index.html.twig');
    }

    /**
     * This is the documentation description of your method, it will appear
     * on a specific pane. It will read all the text until the first
     * annotation.
     *
     * @ApiDoc(
     *  resource=true,
     *  description="This is a description of your API method",
     *  filters={
     *      {"name"="a-filter", "dataType"="integer"},
     *      {"name"="another-filter", "dataType"="string", "pattern"="(foo|bar) ASC|DESC"}
     *  }
     * )
     */
    public function getAction()
    {
    }

    /**
     * API详细说明-
     * 会一直扫描到第一个注释
     *
     * @ApiDoc(
     *  resource=true,
     *  section=false,
     *  description="API简单说明",
     *  filters={
     *      {"name"="a-filter", "dataType"="integer"},
     *      {"name"="another-filter", "dataType"="string", "pattern"="(foo|bar) ASC|DESC"}
     *  },
     *  requirements={
     *      {
     *          "name"="limit",
     *          "dataType"="integer",
     *          "requirement"="\d+",
     *          "description"=""
     *      }
     *  },
     *  tags={
     *     "这个是标签"
     * },
     *  parameters={
     *      {"name"="categoryId", "dataType"="integer", "required"=true, "format"="['']", "description"="类型id"}
     *  },
     *  headers={
     *      {
     *         "name"="嘿嘿黑",
     *         "description"="这个是描述"
     *      }
     *   },
     *  output="ApiBundle\Controller\DefaultController"
     * )
     *
     */
    public function postAction()
    {
    }

    /**
     * @ApiDoc(
     *  description="Returns a collection of Object",
     *  requirements={
     *      {
     *          "name"="limit",
     *          "dataType"="integer",
     *          "requirement"="\d+",
     *          "description"="how many objects to return"
     *      }
     *  },
     *  parameters={
     *      {"name"="categoryId", "dataType"="integer", "required"=true, "description"="category id"}
     *  }
     * )
     */
    public function cgetAction($limit)
    {
    }
}
